<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>vue中事件学习</title>
		
	</head>
	<body>
		<div id="app">
			<h1 v-text="num"></h1>
			<br/>
			<button v-on:click="num++">自增</button>
			<!-- 简化操作@click -->
			<button @click="num++">自增的简写</button>
			<button @click="addNum2">方法自增</button>
		</div>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
	<script>
		
		const app = new Vue({
			el:"#app",
			data:{
				num:1
			},
			methods: {
				// key:value
				addNum:function(){
					this.num++
				},
				// addnum2 = addnum2:function
				addNum2(){
				this.num+=2
			}
			}
		})
		console.log(app.num)
	</script>
	</body>
</html>
